package me.leiusual.sharing.ui

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.ActivityScope
import me.leiusual.sharing.di.ViewModelKey
import me.leiusual.sharing.ui.account.AccountModule
import me.leiusual.sharing.ui.cart.CartModule
import me.leiusual.sharing.ui.home.HomeModule
import me.leiusual.sharing.ui.mine.MineModule
import me.leiusual.sharing.ui.order.OrderModule
import me.leiusual.sharing.ui.product.ProductModule
import me.leiusual.sharing.ui.setting.SettingModule
import me.leiusual.sharing.ui.shop.ShopModule
import me.leiusual.sharing.ui.store.StoreModule
import me.leiusual.sharing.ui.useraccount.UserAccountModule

/**
 * Create by leiusual on 2018/7/15
 */
@Suppress("unused")
@Module
abstract class ActivityModule {

  @ActivityScope
  @ContributesAndroidInjector(modules = [
    AccountModule::class,
    CartModule::class,
    HomeModule::class,
    MineModule::class,
    OrderModule::class,
    ProductModule::class,
    SettingModule::class,
    ShopModule::class,
    StoreModule::class,
    UserAccountModule::class
  ])
  abstract fun mainActivity(): MainActivity

  @Binds
  @IntoMap
  @ViewModelKey(MainViewModel::class)
  abstract fun mainViewModel(mainViewModel: MainViewModel): ViewModel

  @ActivityScope
  @ContributesAndroidInjector
  abstract fun startActivity(): StartActivity

  @Binds
  @IntoMap
  @ViewModelKey(StartViewModel::class)
  abstract fun startViewModel(startViewModel: StartViewModel): ViewModel
}